Compiling with Types

نویسندگان

  • Greg Morrisett
  • Peter Lee
  • Andrew Appel
چکیده

Compilers for monomorphic languages, such as C and Pascal, take advantage of types to determine data representations, alignment, calling conventions, and register selection. However, these languages lack important features including polymorphism, abstract datatypes, and garbage collection. In contrast, modern programming languages such as Standard ML (SML), provide all of these features, but existing implementations fail to take full advantage of types. The result is that performance of SML code is quite bad when compared to C. In this thesis, I provide a general framework, called type-directed compilation, that allows compiler writers to take advantage of types at all stages in compilation. In the framework, types are used not only to determine e cient representations and calling conventions, but also to prove the correctness of the compiler. A key property of typedirected compilation is that all but the lowest levels of the compiler use typed intermediate languages. An advantage of this approach is that it provides a means for automatically checking the integrity of the resulting code. An important contribution of this work is the development of a new, staticallytyped intermediate language, called ML i . This language supports dynamic type dispatch, providing a means to select operations based on types at run time. I show how to use dynamic type dispatch to support polymorphism, ad-hoc operators, and garbage collection without having to box or tag values. This allows compilers for SML to take advantage of techniques used in C compilers, without sacri cing language features or separate compilation. To demonstrate the applicability of my approach, I, along with others, have constructed a new compiler for SML called TIL that eliminates most restrictions on the representations of values. The code produced by TIL is roughly twice as fast as code produced by the SML/NJ compiler. This is due at least partially to the use of natural representations, but primarily to the conventional optimizer which manipulates typed, ML i code. TIL demonstrates that combining type-directed compilation with dynamic type dispatch yields a superior architecture for compilers of modern languages.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Evaluating the Residents’ Opinions of the Neighborhood about the Inter-productive Structures in Historical Context of Julfa, Isfahan

Isfahan’s Julfa neighborhood has been one of the valuable historical neighborhoods related to the Safavid era. It is different from other neighborhoods of the city due to the residents’ cultural-religious differences. Interventions in historical contexts are taking place with a variety of approaches around the world. The present study was conducted to answer this question: What should the inter...

متن کامل

Compiling Laziness Using Projection Types

Strictness analysis is accepted as an important tool for the eecient implementation of lazy functional languages. However, the analyses are usually rst-order and the optimisations that follow may be ad hoc. Using projections to represent static properties of programs is appealing because they naturally describe component-wise demand on data structures and can handle latent demands such as head-...

متن کامل

Compiling the Process Functional Programs

This paper briefly describes process functional language compiler architecture. Process functional language is an experimental functional language with imperative features like memory cell variables. The main parts of the process functional language compiler are presented with short description and examples. Current implementation of PFL compiler comprises a algebraic types, primitive functions...

متن کامل

Parametricity as Subtyping (preliminary Report)

A polymorphic function is parametric if it has uniform behavior for all type parameters. This property is useful when writing, reasoning about, and compiling functional programs. We show how to syntactically deene and reason about parametricity in a language with intersection types and bounded polymorphism. Within this framework, parametricity is subtyping, and reasoning about para-metricity be...

متن کامل

Designing and Compiling a Human Capital Management Model in West Oil and Gas Exploitation Company

The purpose of this study is to design human capital management model in West Oil and Gas Exploitation Company. This research is an applied development in terms of purpose and qualitative in terms of nature. Experts were identified by targeted sampling and snowball sampling, which interviewed with 15 experts. The method of analysis was grounded theory and data were collected through semi-struct...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1995